<link href="{{asset('css/table/table.css')}}" rel="stylesheet"/>
<style>
    .layui-edge {
        right: 161px !important;
    }

    .layui-input {
        width: 60% !important;
    }

    .layui-form-select dl {
        min-width: 60% !important;
    }
</style>
<form id="categroy_create" style="margin-top: 15px;" action="{{route('admin.category.create')}}" class="layui-form">
    {{csrf_field()}}
    <div class="layui-form-item">
        <label class="layui-form-label">名称</label>
        <div class="layui-input-block">
            <input type="text" id="name" name="data[name]" autocomplete="off" placeholder="名称" class="layui-input">
        </div>
    </div>

    @if($groupId==1)
        <div class="layui-form-item">
            <label class="layui-form-label">使用范围</label>
            <div class="layui-input-block">
                @if($course==1)
                    <input type="checkbox" name="data[scope][]" class="parent" lay-skin="primary"
                           value="course" title="课程">
                @endif
                @if($exam==1)
                    <input type="checkbox" name="data[scope][]" class="parent" lay-skin="primary"
                           value="exam" title="考试">
                @endif
            </div>
        </div>
    @endif

    <div class="layui-form-item">
        <label class="layui-form-label">分组</label>
        <div class="layui-input-block">
            <select id="group_id" disabled lay-filter="search_type">
                <option @if(request("group_id")=="") selected @endif value="">--选择分组--</option>
                @foreach($group as $g)
                    <option @if($groupId==$g["id"]) selected @endif value='{{$g["id"]}}'>{{$g["name"]}}</option>
                @endforeach
            </select>
            <input name="data[group_id]" value="{{$groupId}}" style="display: none;"/>

        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">父级</label>
        <div class="layui-input-block">
            <select disabled>
                <option value="{{$parent['id']}}">--{{$parent['name']}}--</option>
            </select>
            <input id="parent_id" name="data[parent_id]" value="{{$parent['id']}}" style="display: none">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-block">
            <textarea type="text" id="description" name="data[description]" placeholder="分类描述" style="height: 100px;"
                      class="layui-input"></textarea>
        </div>
    </div>
</form>
